<#include "./template/general_temp.ftl">

<#macro content>
<div class="row">
    <div class="box col-md-12">
        <div class="box-inner">
            <div class="box-header well" data-original-title="">
                <h2><i class="glyphicon glyphicon-user"></i>消息管理</h2>

                <div class="box-icon">
                    <a href="#" class="btn btn-setting btn-round btn-default"><i class="glyphicon glyphicon-cog"></i></a>
                    <a href="#" class="btn btn-minimize btn-round btn-default"><i
                            class="glyphicon glyphicon-chevron-up"></i></a>
                    <a href="#" class="btn btn-close btn-round btn-default"><i class="glyphicon glyphicon-remove"></i></a>
                </div>
            </div>
            <div class="box-content">
                <div class="alert alert-info">
                    <a class="btn btn-success" href="${base}/system/message/add"><i class="glyphicon glyphicon-plus icon-white"></i>发送消息</a>
                </div>
                <table id="dg">
                </table>
            </div>
        </div>
    </div>
    <!--/span-->

</div><!--/row-->
</#macro>

<#macro script>
<script type="text/javascript">
    $(document).ready(function () {
        list();
    });

    function list(){
        //构造列表
        jQuery('#dg').datagrid({
            url:'${base}/system/message/list',
            fitColumns : true,
            striped : true,
            pagination : true,
            rownumbers : true,
            pageSize : 20,
            pageNumber : 1,
            pageList : [ 20, 50],
            loadMsg : '数据正在加载中...',
            singleSelect:true,
            queryParams : {"data":111},
            selectOnCheck : false,
            checkOnSelect : false,
            width:$('.box-content').width() * 0.985,
            columns : [[
                {field : 'title', title : '标题',  resizable : true, hidden : false, sortable : false, width:$(this).width()*0.05, align: 'center'},
                {field : 'createTimeStr', title : '发送时间',  resizable : true, hidden : false, sortable : false, width:$(this).width()*0.1, align: 'center'},
                {field : 'targetStr', title : '发送对象',  resizable : true, hidden : false, sortable : false, width:$(this).width()*0.1, align: 'center'},
                {field : 'creatorStr', title : '操作人',  resizable : true, hidden : false, sortable : false, width:$(this).width()*0.05, align: 'center'},
                {field : 'statusStr', title : '是否已读',  resizable : true, hidden : false, sortable : false, width:$(this).width()*0.05, align: 'center'}
            ]],
            onLoadSuccess:function(data){
            },
            onClickRow: function (rowIndex, rowData) {

            }
        });
    }

    function reQueryData() {
        list();
        $('.page-sidebar, .header').on('click', '.sidebar-toggler', function (e) {
            $('#dg').datagrid('resize');
        });
    }
</script>
</#macro>
